#!/bin/tcsh -ef
#############################################################################
#                                                                           #
# Title: AUX-FREALIGN Stats			                    					#
#                                                                           #
# (C) 2dx.org, GNU Plublic License.                                         #
#                                                                           #
# Created..........: 29/07/2016                                             #
# Last Modification: 29/07/2016                                             #
# Author...........: 2dx.org                                                #
#                                                                           #
#############################################################################
#
# SORTORDER: 140
#
#
# MANUAL: This script calculates some refinement stats given .par files.
#
# DISPLAY: SPR_DIR
# DISPLAY: SPR_PARPATH
#
#$end_local_vars

set SPR_PARPATH = ""

set SPR_DIR = ""
set SPR_FREALIGN_DIR = ${SPR_DIR}/FREALIGN
set SPR_PARPATH = ${SPR_FREALIGN_DIR}/${SPR_PARPATH}
set SPR_STATS_DIR = ${SPR_DIR}/STATS

set bin_2dx = ""
set proc_2dx = ""

set scriptname = Par2Stats

#$end_vars

if ( -e LOGS/${scriptname}.results ) then
	mv LOGS/${scriptname}.results LOGS/${scriptname}.results.old
endif

# Check if initial files exist:
if ( ! -e ${SPR_STATS_DIR} ) then
	mkdir -p ${SPR_STATS_DIR}
endif

# Run the script:
${app_python} ${proc_2dx}/SPR_Par2Stats.py ${SPR_STATS_DIR} ${SPR_PARPATH}

foreach i (${SPR_STATS_DIR}/*.png)
	echo "# IMAGE-IMPORTANT: $i <PNG: `basename $i`>" >> LOGS/${scriptname}.results
end

echo ":: "
echo ":: Done!"
echo ":: "
